package online.heycm.rbac.common.utils;

import online.heycm.platform.common.tools.cipher.AESEncrypt;
import online.heycm.rbac.common.constant.Constant;

/**
 * AES加密工具
 *
 * @author hey
 * @version 1.0
 * @date 2024/1/12 16:42
 */
public class AesUtil {

    private static final AESEncrypt ENCRYPT = new AESEncrypt(Constant.AES_SECRET);

    private AesUtil() {
    }

    public static String encrypt(String content) {
        return ENCRYPT.encrypt(content);
    }

    public static String decrypt(String encrypt) {
        return ENCRYPT.decrypt(encrypt);
    }

    public static void main(String[] args) {
        String content = "13800000001";
        String encrypt = encrypt(content);
        String decrypt = decrypt(encrypt);
        System.out.println("encrypt = " + encrypt);
        System.out.println("decrypt = " + decrypt);
        content = "江左梅长苏";
        encrypt = encrypt(content);
        decrypt = decrypt(encrypt);
        System.out.println("encrypt = " + encrypt);
        System.out.println("decrypt = " + decrypt);
    }
}
